package com.weijianhuawen.wjblog.admin.controller;

import com.weijianhuawen.wjblog.admin.mode.vo.setting.UpdateBlogSettingsReqVo;
import com.weijianhuawen.wjblog.admin.service.AdminBlogSettingsService;
import com.weijianhuawen.wjblog.common.aspect.ApiOperationLog;
import com.weijianhuawen.wjblog.common.utils.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description:
 * @date: 2024-10-23 22:10
 */
@RestController
@RequestMapping("/admin/blog/settings")
@Api(tags = "Admin 博客设置模块")
public class AdminBlogSettingsController {
    @Resource
    private AdminBlogSettingsService  adminBlogSettingsService;


    @PostMapping("/update")
    @ApiOperation(value = "博客基础信息修改")
    @ApiOperationLog(description = "博客信息修改")
    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public Object updateBlogSettings(@RequestBody @Validated UpdateBlogSettingsReqVo vo) {
        return adminBlogSettingsService.updateBlogSettings(vo);
    }

    @GetMapping("/detail")
    @ApiOperation(value = "获取博客设置详情")
    @ApiOperationLog(description = "获取博客设置详情")
    public Response findDetail() {
        AdminBlogSettingsController blogSettingsService;
        return adminBlogSettingsService.findDetail();
    }
}
